﻿	      <?php include("conn.php");
             mysql_query('SET NAMES UTF8'); 

	  

class MyPrizeBean
{
	
	public $content;
	function __construct($content)
	{
	
		$this->content      = $content;
		
	}
}

	$count=mysql_query("select count(*) from message");

//收藏的宝贝 计数
$rs=mysql_fetch_array($count);
$t1=$rs[0];

if($_GET[page]!="")
{
$s=$_GET[page]*10;
$page=$t1-$s;
}
else
{
$s=10;
$page=$t1-10;
}



	$rert30=mysql_query("select *from message order by messageid limit $page,$s");
	
	$prize = array();
	$content="";
	


	
while($rowf=mysql_fetch_array($rert30))
{


	  
 
$rert32=mysql_query("select *from user where  userid ='".$rowf[userid]."'");
		  $rowf1=mysql_fetch_array($rert32);
		 if($rowf[userid]==$_REQUEST[userid])
		  {
		     if(strpos($rowf[content],".amr") > 0){
			 
			                     $content.="<li class=my url='".$rowf[shu]."'  onClick=play('".$rowf[content]."',this)><div class=cnt><div class=cnt_border  ><img src='../image/yy.png' height='20' width='20' class='yy'/>   <span class='time'>".$rowf[times]."s</span></div><span class=bg></span><span class=bor></span></div><div class=head_image><img src='http://120.24.0.10/zhiqin/api/".$rowf1[images]."'/></div></li>";
			                   }
							   
							   else if(strpos($rowf[content],".png") > 0 and strpos($rowf[content],".png") < 2)
								{			   
		 $content.="<li class=my><div class=cnt><div class=cnt_border   >".$rowf[content]."</div><span class=bg></span><span class=bor></span></div><div class=head_image><img src='http://120.24.0.10/zhiqin/api/".$rowf1[images]."'/></div></li>";
								}
								
							   else
							   {
							   
		 $content.="<li class=my><div class=cnt><div class=cnt_border   >".$rowf[content]."</div><span class=bg></span><span class=bor></span></div><div class=head_image><img src='http://120.24.0.10/zhiqin/api/".$rowf1[images]."'/></div></li>";
		                       }
		 }
		 else
		  {
		      
			  if(strpos($rowf[content],".amr") > 0){
			   $content.="<li class='you' url='".$rowf[shu]."'  onClick=play('".$rowf[content]."',this)><div class='head_image'><img src='http://120.24.0.10/zhiqin/api/".$rowf1[images]."'/></div><div class='cnt'><div class='cnt_border'><div class='cnt_content' ><img class='yy' src='../image/yy.png' height='20' width='20'/></div><span class='time'>".$rowf[times]."s</span></div><span class='bg'></span><span class='bor'></span></div></li>";
			  }
				  else if(strpos($rowf[content],".png") > 0 and strpos($rowf[content],".png") < 2)
								{	
								 $content.="<li class='you'><div class='head_image'><img src='http://120.24.0.10/zhiqin/api/".$rowf1[images]."'/></div><div class='cnt'><div class='cnt_border'><div class='cnt_content' >".$rowf[content]."<div></div></div></div><span class='bg'></span><span class='bor'></span></div></li>";
								}
							
			  else
			  {
		 $content.="<li class='you'><div class='head_image'><img src='http://120.24.0.10/zhiqin/api/".$rowf1[images]."'/></div><div class='cnt'><div class='cnt_border'><div class='cnt_content'>".$rowf[content]."<div></div></div></div><span class='bg'></span><span class='bor'></span></div></li>";
		     }
		 }
	}		
	
	$prize[] = new MyPrizeBean($content);
		
	

echo json_encode($prize);


?>